import Router from 'koa-router';
import { Context } from 'vm';
const router = new Router();
import query from '../quer/quer'
import jwt from 'jsonwebtoken'

function login(ctx: Context) {
    const { username, password }: any = ctx.request.body

    if (username == "123" && password == "123") {
        // 
        const token: any = jwt.sign({
            data: {
                username: "123",
                password: "123"
            }
        }, 'byp', { expiresIn: '1h' });
        // 
        ctx.body = { code: 200, token }
    } else {
        ctx.body = { code: 400 }
    }
}
router.post("/login", login)

export default router;